require 'thor'
class Thor
  module Cheese
    VERSION = "0.1.0"
  
    autoload :UI,   'thor-cheese/ui'
  
    ##
    # Generic class to build your own error-extensions from.  Copied from Bundler
    #
    class Error < StandardError
      def self.status_code(code = nil)
        return @code unless code
        @code = code
      end

      def status_code
        self.class.status_code
      end
    end
  
    ##
    # Example error-extension
    #
    class ArgumentError  < Error; status_code(666) ; end
  
    class << self
      def included(klass)
        klass.send(:extend, ClassMethods)
      end
    end
  
    module ClassMethods  
    
      def shell=(shell)
        @ui ||= UI::Shell.new(shell)
      end
    
      def ui
        @ui ||= UI.new
      end
    end
  end
end